<template>
  <div>
    <input v-model="protocol">
    <input v-model="host">
    <input v-model="port">
    <input v-model="username">
    <input v-model="password">
    <button @click="connect()">Connect</button>
  </div>
</template>

<script>
export default {
    name: 'MyComponent',
    data() {
        return {
          protocol: 'bolt',
      host: '172.16.218.125',
      port: 7687,
      username: 'neo4j',
      password: '123456',
        }
    },
    mounted(){
      this.connect();
    },
    methods: {
        connect() {
            return this.$neo4j.connect(this.protocol, this.host, this.port, this.username, this.password)
                .then(driver => {
                    // Update the context of your app
                })
        },
        driver() {
            // Get a driver instance
            return this.$neo4j.getDriver()
        },
        testQuery() {
            // Get a session from the driver
            const session = this.$neo4j.getSession()

            // Or you can just call this.$neo4j.run(cypher, params)
            session.run('MATCH (n) RETURN count(n) AS count')
                .then(res => {
                    console.log(res.records[0].get('count'))
                })
                .then(() => {
                    session.close()
                })
        }
    }
};